package com.geeklan.smart.ui.viewmodel.device;

import androidx.lifecycle.ViewModel;
import androidx.lifecycle.ViewModelProvider;

import com.geeklan.smart.data.repository.device.DeviceRepository;
import com.geeklan.smart.data.repository.user.AccountRepository;
import com.geeklan.smart.ui.viewmodel.user.UserViewModel;

public class DeviceViewModelFactory implements ViewModelProvider.Factory {

    private final DeviceRepository deviceRepository;

    public DeviceViewModelFactory(DeviceRepository deviceRepository) {
        this.deviceRepository = deviceRepository;
    }

    @Override
    public <T extends ViewModel> T create(Class<T> modelClass) {
        if (modelClass.isAssignableFrom(DeviceViewModel.class)) {
            return (T) new DeviceViewModel(deviceRepository);
        }
        throw new IllegalArgumentException("Unknown ViewModel class");
    }
}

